<table class="w100" style="margin-bottom: 20px;">
	<tr>
		<td>
			<a href="<?=Request::$controller?>messages/" class="awesome light-gray">&larr; to message list</a><br />
		</td>
		<td>
			<? if (isset($messageId)): ?>
				<a href="<?=Request::$controller?>message/<?=$messageId?>" class="awesome orange">&larr; 1. Message editor</a>
			<? else: ?>
				<a href="<?=Request::$controller?>message/" class="awesome green">1. Compose message</a>
			<? endif; ?>
		</td>
		<td>
			<? if (isset($messageId)): ?>
				<a href="<?=Request::$controller?>attachments/<?=$messageId?>/" class="awesome green">2. Attachments</a>
			<? else: ?>
				<span class="awesome disabled">2. Attachments</span>
			<? endif; ?>
		</td>
		<td>
			<? if (isset($messageId)): ?>
				<a href="<?=Request::$controller?>recipients/<?=$messageId?>/" class="awesome orange">3. Recipient list &rarr;</a>
			<? else: ?>
				<span class="awesome disabled">3. Recipient list</span>
			<? endif; ?>
		</td>
	</tr>
</table>
<h1>Attachments</h1>
<? if (count($attachments)): ?>
<table class="w100 TableWithPadding TableWithBorder">
	<thead>
		<tr>
			<th class="w70">
				Attachment
			</th>
			<th class="w15">
				Size
			</th>
			<th class="w5">
				Delete
			</th>
		</tr>
	</thead>
	<tbody>
		<? foreach ($attachments as $attachment): ?>
			<tr>
				<td>
					<a href="<?=$pathAttachments . $messageId . '/' . $attachment['alias'] . '/' . $attachment['filename']?>" target="_blank"><?=$attachment['filename']?></a>
				</td>
				<td><?=number_format(($attachment['filesize'] / 1024), 2, '.', ' ');?>kb</td>
				<td>
					<?=Html::anchor(Request::$controller.'removeAttachment/' . $attachment['id'] . '/', '<img src="/images/icons/remove.png" />', array('onclick' => 'javascript:return confirm("Are you sure?")'))?>
				</td>
			</tr>
		<? endforeach; ?>
	</tbody>
</table>
<? else: ?>
<p class="large">No attachments has been uploaded yet for this message.</p>
<? endif; ?>
<br />
<hr />
<p class="large blue">Upload attachment</p>
<p>
<? if (count($attachments)): ?>
	Your <strong>current</strong> attachments size: <?=number_format(($totalSize / 1024), 2, '.', '');?>Kb (~<?=number_format(($totalSize / (1024 * 1024)), 1, '.', '')?>Mb)
	<br />
<? endif; ?>
	Total size of your attachments <strong>must not exceed  <?=number_format(($maxSize / (1024 * 1024)), 0, '.', '');?>Mb</strong>
</p>
<?=$form?>